﻿<%@ Page Language="C#" MasterPageFile="~/SimplePMT.Master" AutoEventWireup="true" CodeBehind="History.aspx.cs" Inherits="SimplePMT.History" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="MainContent">
    <p>
    <table width="100%" cellpadding=3 cellspacing=0 border=0>
        <tr>
            <td style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><b>Tasks History For:</b> <%= FormElement.Select(150, "MemberID", memberId, memberOptions, "onChange=\"getQueue(this.options[this.selectedIndex].value);\"", true) %></td>
            <td style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE" align=right></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" valign=top bgcolor="#ffffff" colspan=2>
                <div id="TaskHistoryBlock">
                <%= taskHistory %>
                </div>
            </td>
        </tr>
        
    </table>
    </p>
    <script>
        
        var project = false;
        var sortDesc = false;
        var fieldLast = '';
        var memberId = <%= memberId %>;
        
        function getQueue(mid) {
            memberId = mid
            SimplePMT.Ajax.Home.GetTaskHistory(mid, function (response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
                document.getElementById('TaskHistoryBlock').innerHTML = response.value;
            });
        }
        
        function sortQueue(field) {
            if (field != fieldLast)
                sortDesc = false;
                
            if (sortDesc) {
                //s.innerHTML = '(ascending) ';
                sortDesc = false;
            } else {
                //s.innerHTML = '(descending) ';
                sortDesc = true;
            }
            fieldLast = field;
            SimplePMT.Ajax.Home.GetWorkQueue(memberId, field, sortDesc, function (response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
                document.getElementById('WorkQueue').innerHTML = response.value;
            });
        }
        
        function sortUnassignedQueue(field) {
            if (field != fieldLast)
                sortDesc = false;
                
            if (sortDesc) {
                //s.innerHTML = '(ascending) ';
                sortDesc = false;
            } else {
                //s.innerHTML = '(descending) ';
                sortDesc = true;
            }
            fieldLast = field;
            SimplePMT.Ajax.Home.GetUnassignedQueue(field, sortDesc, function (response) {
                if (response.error != null) {
                    alert(response.error.Message);
                }
                document.getElementById('UnassignedWorkQueue').innerHTML = response.value;
            });
        }
    </script>
</asp:Content>